package top.fzqblog.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import top.fzqblog.firstapp.R;

/**
 * Created by 抽离 on 2017/9/18 0018.
 */

public class TabLayoutFragment extends Fragment {

    public static final String ARG_PAGE = "ARG_PAGE";
    private int mPage;

    @BindView(R.id.tab_layout_test_tv)
    public TextView textView;

    public static TabLayoutFragment newInstance(int page){
        Bundle bundle = new Bundle();
        bundle.putInt(ARG_PAGE, page + 1);
        TabLayoutFragment tabLayoutFragment = new TabLayoutFragment();
        tabLayoutFragment.setArguments(bundle);
        return tabLayoutFragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPage = getArguments().getInt(ARG_PAGE);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.tab_layout_fragment, container, false);
        ButterKnife.bind(this, view);
        textView.setText("第" + mPage + "页");
        return view;
    }
}
